package org.itheimma.springbootquickstart.mapepr;

import org.apache.ibatis.annotations.*;
import org.itheimma.springbootquickstart.pojo.Models;

import java.util.List;

@Mapper
public interface ModelMapper {
//    @Select("select * from models where Three_id=#{threeId}")
//    Models findByMId(int threeId);

    @Select("insert into models(image_id, Three_url, uploaded_by, uploaded_timestamp)" +
            " values(NULL,#{Three_url},#{uploaded_by},now())")
    @Options(useGeneratedKeys=true, keyProperty="Three_id", keyColumn="Three_id")
    void add(Models model);

    @Update("update models set image_id = #{imageId} where Three_id = #{threeId}")
    void uploadImgId(String imageId,int threeId);
}
